package yk.com.AllMenu;

import yk.com.StudentManager;
import java.util.Scanner;

public class RemoveStudent {
    public static void execute(Scanner scanner) {
        // 显示删除菜单
        displayRemoveMenu();
        System.out.print("请输入您的选择: ");
        int removeChoice = scanner.nextInt();
        scanner.nextLine(); // 清除输入缓冲区

        // 根据删除选择执行操作
        switch (removeChoice) {
            case 1:
                removeStudentById(scanner);
                break;
            case 2:
                removeAllStudents();
                break;
            default:
                System.out.println("无效的选择，请重新输入！");
                break;
        }
    }

    // 显示删除菜单
    private static void displayRemoveMenu() {
        System.out.println("-----删除学生-----");
        System.out.println("1. 按照学号删除学生");
        System.out.println("2. 删除所有学生");
    }

    // 按照学号删除学生
    private static void removeStudentById(Scanner scanner) {
        System.out.print("请输入要删除学生的学号: ");
        String id = scanner.nextLine();

        StudentManager.removeStudent(id);
    }

    // 删除所有学生
    private static void removeAllStudents() {
        StudentManager.removeAllStudents();
    }
}